<?php

require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php");

require_once('../openid_include.php');

// let admins configure the OpenID client

if (is_admin()) {

	$always_sync = get_input('always_sync');
	$default_server = trim(get_input('default_server'));
	$greenlist = trim(get_input('greenlist'));
	$yellowlist = trim(get_input('yellowlist'));
	$redlist = trim(get_input('redlist'));
	datalist_set('openid_client_default_server',$default_server);
	if ($always_sync) {
		datalist_set('openid_client_always_sync',$always_sync);
	} else {
		datalist_set('openid_client_always_sync','no');
	}		
	datalist_set('openid_client_greenlist',$greenlist);
	datalist_set('openid_client_yellowlist',$yellowlist);
	datalist_set('openid_client_redlist',$redlist);
	system_message(elgg_echo('openid_client:admin_response'));
	
	forward($CONFIG->wwwroot . "mod/openid_client/admin.php");
    
} else {
    // no authorisation, so just display the front page
    forward();
}

?>
